package main

// 队列有两个指针 一个head 一个tail tail处入列 head处出列 所以是先进先出
//type MyQueue[T MyInt] struct {
//	head *Node1[T]
//	tail *Node1[T]
//	size T
//}
//
//func (receiver *MyQueue[T]) QueueSize() T {
//	return receiver.size
//}
//
//func (receiver *MyQueue[T]) IsEmpty() bool {
//	return receiver.size == 0
//}
//func (receiver *MyQueue[T]) offer(v T) {
//	var n = Node1[T]{Value: v, Next: nil}
//	if receiver.head == nil {
//		receiver.head = &n
//		receiver.tail = &n
//	} else {
//		receiver.tail.Next = &n
//		receiver.tail = &n
//	}
//
//	receiver.size++
//}
//func (receiver *MyQueue[T]) poll() T {
//	var v T = -1
//	if receiver.size == 0 {
//		receiver.head, receiver.tail = nil, nil
//
//	} else if receiver.size == 1 {
//		v = receiver.head.Value
//		receiver.head = nil
//		receiver.tail = nil
//		receiver.size--
//
//	} else {
//		v = receiver.head.Value
//		receiver.head = receiver.head.Next
//		receiver.size--
//	}
//	return v
//
//}
//func (receiver MyQueue[T]) peek() T {
//	var v T = -1
//
//	if receiver.head != nil {
//		v = receiver.head.Value
//	}
//
//	return v
//}
//
//func main() {
//
//	var mq MyQueue[int]
//	mq.offer(99)
//	mq.offer(88)
//	mq.offer(77)
//	fmt.Println(mq.peek())
//	fmt.Println(mq.poll())
//	fmt.Println(mq.peek())
//	fmt.Println(mq.poll())
//	fmt.Println(mq.peek())
//	fmt.Println(mq.poll())
//	fmt.Println(mq.peek())
//
//}
